Skip to content

Refactor attributes benchmark tests#2167

Merged
MrAlias merged 2 commits intoopen-telemetry:mainfrom
MrAlias:attr-bench-refactor
Aug 11, 2021
Merged

Refactor attributes benchmark tests#2167
MrAlias merged 2 commits intoopen-telemetry:mainfrom
MrAlias:attr-bench-refactor

Conversation

@MrAlias
Copy link
Copy Markdown
Contributor

@MrAlias MrAlias commented Aug 6, 2021

Part of #2162

Group benchmarks by type for easier understanding and filtering. This also makes it easier to extend the benchmarks with the slice types in #2162.

Save output of function calls in benchmarks to file level vars to ensure the compiler does not optimize away the test.

Unify testing functionality for common benchmark tasks.

Results

$ go test -bench=.
goos: linux
goarch: amd64
pkg: go.opentelemetry.io/otel/attribute
cpu: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
BenchmarkBool/Value-8         	837967860	         1.365 ns/op	       0 B/op	       0 allocs/op
BenchmarkBool/KeyValue-8      	141840978	         8.438 ns/op	       0 B/op	       0 allocs/op
BenchmarkBool/AsBool-8        	830254604	         1.438 ns/op	       0 B/op	       0 allocs/op
BenchmarkBool/Any-8           	56767537	        20.52 ns/op	       0 B/op	       0 allocs/op
BenchmarkBool/Emit-8          	152135484	         8.150 ns/op	       0 B/op	       0 allocs/op
BenchmarkBool/Array/KeyValue-8         	 6962660	       171.9 ns/op	       6 B/op	       2 allocs/op
BenchmarkBool/Array/Emit-8             	 4518294	       264.8 ns/op	      24 B/op	       1 allocs/op
BenchmarkInt/Value-8                   	878547782	         1.362 ns/op	       0 B/op	       0 allocs/op
BenchmarkInt/KeyValue-8                	142509892	         8.441 ns/op	       0 B/op	       0 allocs/op
BenchmarkInt/Any-8                     	61482669	        19.11 ns/op	       0 B/op	       0 allocs/op
BenchmarkInt/Emit-8                    	100000000	        10.20 ns/op	       0 B/op	       0 allocs/op
BenchmarkInt/Array/KeyValue-8          	 6347354	       189.1 ns/op	      48 B/op	       2 allocs/op
BenchmarkInt/Array/Emit-8              	 3963114	       293.2 ns/op	      16 B/op	       1 allocs/op
BenchmarkInt8/Any-8                    	59708636	        19.78 ns/op	       0 B/op	       0 allocs/op
BenchmarkInt16/Any-8                   	61288166	        19.17 ns/op	       0 B/op	       0 allocs/op
BenchmarkInt32/Any-8                   	 8011390	       149.1 ns/op	      16 B/op	       2 allocs/op
BenchmarkInt64/Value-8                 	872580108	         1.398 ns/op	       0 B/op	       0 allocs/op
BenchmarkInt64/KeyValue-8              	141928178	         8.446 ns/op	       0 B/op	       0 allocs/op
BenchmarkInt64/AsInt64-8               	832221681	         1.437 ns/op	       0 B/op	       0 allocs/op
BenchmarkInt64/Any-8                   	62070606	        19.91 ns/op	       0 B/op	       0 allocs/op
BenchmarkInt64/Emit-8                  	100000000	        10.27 ns/op	       0 B/op	       0 allocs/op
BenchmarkInt64/Array/KeyValue-8        	 6350991	       188.1 ns/op	      48 B/op	       2 allocs/op
BenchmarkInt64/Array/Emit-8            	 3714741	       318.8 ns/op	      16 B/op	       1 allocs/op
BenchmarkFloat64/Value-8               	864163021	         1.400 ns/op	       0 B/op	       0 allocs/op
BenchmarkFloat64/KeyValue-8            	142354496	         8.416 ns/op	       0 B/op	       0 allocs/op
BenchmarkFloat64/AsFloat64-8           	830226676	         1.438 ns/op	       0 B/op	       0 allocs/op
BenchmarkFloat64/Any-8                 	55845655	        18.90 ns/op	       0 B/op	       0 allocs/op
BenchmarkFloat64/Emit-8                	 8898853	       134.2 ns/op	      16 B/op	       2 allocs/op
BenchmarkFloat64/Array/KeyValue-8      	 6252316	       190.1 ns/op	      48 B/op	       2 allocs/op
BenchmarkFloat64/Array/Emit-8          	 2609178	       466.8 ns/op	      16 B/op	       1 allocs/op
BenchmarkString/Value-8                	183315844	         6.536 ns/op	       0 B/op	       0 allocs/op
BenchmarkString/KeyValue-8             	134555676	         8.902 ns/op	       0 B/op	       0 allocs/op
BenchmarkString/AsString-8             	639765589	         1.884 ns/op	       0 B/op	       0 allocs/op
BenchmarkString/Any-8                  	51048147	        24.67 ns/op	       0 B/op	       0 allocs/op
BenchmarkString/Emit-8                 	168750364	         7.197 ns/op	       0 B/op	       0 allocs/op
BenchmarkString/Array/KeyValue-8       	 5126845	       231.6 ns/op	      96 B/op	       2 allocs/op
BenchmarkString/Array/Emit-8           	 3758732	       312.0 ns/op	      48 B/op	       1 allocs/op
BenchmarkBytes/Any-8                   	44612653	        28.33 ns/op	       0 B/op	       0 allocs/op
BenchmarkStruct/Any-8                  	 7722445	       157.9 ns/op	      16 B/op	       2 allocs/op
PASS

Group benchmarks by type for easier understanding and filtering.

Save output of function calls in benchmarks to file level vars to ensure
the compiler does not optimize away the test.

Unify testing functionality for common benchmark tasks.
@MrAlias MrAlias added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Aug 6, 2021
@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 6, 2021

Codecov Report

Merging #2167 (ae251f6) into main (4c7470d) will increase coverage by 0.0%.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #2167   +/-   ##
=====================================
  Coverage   72.3%   72.4%           
=====================================
  Files        176     176           
  Lines      12095   12095           
=====================================
+ Hits        8755    8758    +3     
+ Misses      3102    3100    -2     
+ Partials     238     237    -1     
Impacted Files Coverage Δ
...s/otlp/otlptrace/internal/connection/connection.go 16.4% <0.0%> (+1.5%) ⬆️

@MrAlias MrAlias merged commit 2b0e139 into open-telemetry:main Aug 11, 2021
@MrAlias MrAlias deleted the attr-bench-refactor branch August 11, 2021 15:49
@pellared pellared added this to the untracked milestone Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Skip Changelog PRs that do not require a CHANGELOG.md entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants